
<div class="modal-dialog" role="document">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="exampleModalLabel">团队添加</h4>
        </div>
        <form style="padding:4%;height:410px;overflow-y:auto;" id="addTeamForm" data-toggle="validator" role="form">
        	<div class="row">
        		<div class="form-group col-sm-3">
	                <label class="control-label">团队名称<span style="color:red;">*</span></label>
	                <input type="text" class="form-control" name="team_name"  value=""  data-error="团队名称为必填项!" placeholder="请输入团队名称" required>
                        <div class="help-block with-errors"></div>
        		</div>
        		<div class="form-group col-sm-3">
	                <label class="control-label">联系人</label>
	                <input type="text" class="form-control" name="contacts"  value="" placeholder="请填写团队联系人" data-error="团队联系人为必填项!" required>
                        <div class="help-block with-errors"></div>
        		</div>
        		<div class="form-group col-sm-3">
	                <label class="control-label">联系人手机号</label>
	                <input type="text" class="form-control" name="contacts_tel"  value="" pattern="^1[34578]\d{9}$" placeholder="11位手机号码" data-error="请输入正确的手机号!" required>
                        <div class="help-block with-errors"></div>
        		</div>
        		<div class="form-group col-sm-3">
	                <label class="control-label">联系邮箱</label>
	                <input type="email" class="form-control" name="contacts_email"  value="" placeholder="邮箱" data-error="你输入的不是一个有效的邮件地址！" value="" required>
                        <div class="help-block with-errors"></div>
        		</div>
        		<div class="form-group col-sm-6">
	                <label class="control-label">项目名称<span style="color:red;">*</span></label>
	                <input type="text" class="form-control" name="name"  value="" placeholder="请填写项目名称" data-error="项目名称为必填项!" required>
                        <div class="help-block with-errors"></div>
        		</div>
        		<div class="form-group col-sm-6">
	                <label class="control-label">所属行业</label>
	                <input type="text" class="form-control" name="industry"  value="" placeholder="请填写所属行业"  data-error="所属行业为必填项!" required>
                        <div class="help-block with-errors"></div>
        		</div>
        		<div class="form-group col-sm-12">
	                <label class="control-label">项目简介</label>
                        <textarea rows="4" class="form-control" name="description" cols="200" placeholder="200字以内"></textarea>
        		</div>
                        <div class="form-group col-sm-6">
	                <label class="control-label">办公空间</label>
	                <select class="form-control" name="space_id">
                            <volist name="spaceList" id="sl">
                                <option value="{$sl.id}">{$sl.name}</option>
                            </volist>
	                </select>
        		</div>
        		<div class="form-group col-sm-6">
	                <label class="control-label">公司名称</label>
	                <select class="form-control" name="company_id">
                            <volist name="companyList" id="cl">
                                <option value="{$cl.id}">{$cl.name}</option>
                            </volist>
	                </select>
        		</div>
        		
        	</div>
        </form>
        <div class="modal-footer">
            <button type="button" data-dismiss="modal" class="btn btn-default">取消</button>
            <button type="button" id="saveTeam" class="btn btn-primary">保存</button>
        </div>
    </div>
</div>
<script type="text/javascript" src="__PUBLIC__/js/select2/select2.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/validator.min.js"></script>
<script>
    
   $("#addTeamForm").validator();


    $("#saveTeam").click(function () {
        var validator = $("#addTeamForm").data("bs.validator");
        validator.validate();
        if(!validator.hasErrors()){
            $.ajax({
                url: "{:U('Admin/Space/Settled/doAddTeam')}",
                type: "post",
                dataType: "json",
                data: $("#addTeamForm").serialize(),
                success: function (data) {
                    if(data){
                        $("#commonModal").modal('toggle');
                        common.alert("提示", "入驻团队添加成功!", function () {
                            common.reload();
                        });
                    }else{
                        common.alert("提示", "入驻团队添加失败!")
                    }
                }
            })
        }
    })
    
</script>